
#ifndef QUEUE_H_
#define QUEUE_H_

/*
*       thread priority queue implementation
*       Authors: danithelion and wilfoa
*/

#include "thread.h"

//a node inside the queue
struct Node;

typedef struct Node{
	struct Thread* _data;
	struct Node* _next;
}Node;

typedef struct Queue{
	Node* _headOfQueue;
	Node* _endOfQueue;
	int _size;
}Queue;

//Allocated memory for a queue and returns a pointer to it
//Responsibility for freeing space is upon the caller of the function
Queue* initQueue();
//Equivalent to 'push' operation but inserts the thread pointer to is location according to it's time stamp
int addThreadToQueue(Queue* queue, struct Thread* thread);
//Returns the pointer to the thread in the head of the queue and removes it or NULL if the queue is empty
struct Thread* popThreadPointerFromQueue(Queue* queue);
//removes the pointer from the queue wherever it is located.
int removeThreadFromQueue(Queue* queue, struct Thread* threadToRemove);
///Returns the pointer to the thread in the head of the queue or NULL if the queue is empty
struct Thread* peekThreadPointerFromQueue(Queue* queue);
//TODO: delete after test
void printQueue(Queue* queue);




#endif /* QUEUE_H_ */
